package com.test.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class TestController {
	
	String message = "Welcome to Spring MVC!";
	
	@RequestMapping("/hello")
	public @ResponseBody Object hello(@RequestParam(value = "name", required = false, defaultValue = "Spring") String name) {
        
        return message;
    }

	@RequestMapping("/hello_object")
	public @ResponseBody Object showMessage(@RequestParam(value = "name", required = false, defaultValue = "Spring") String name) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("result" , 1);
		map.put("info" , "返回数据成功");
		return map;
	}
}
